<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="/webjars/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="/static/js/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="/webjars/bootstrap/4.1.3/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
    <h3><span th:text="${title}">数据如下：</span></h3>
    <table class="table">
        <thead>
        <tr>
            <td>id</td>
            <td>name</td>
            <td>countryCode</td>
            <td>district</td>
            <td>population</td>
            <td>date</td>
            <td>operate</td>
        </tr>
        </thead>
        <tbody>
        <tr th:each="city : ${cityList}">
            <td th:text="${city.id}">1</td>
            <td th:text="${city.name}">武汉</td>
            <td th:text="${city.countryCode}">中国</td>
            <td th:text="${city.district}">每一天都不一样</td>
            <td th:text="${city.population}"></td>
            <td th:text="${#dates.format(curDate, 'yyyy-MM-dd')}">1970-01-01 00:00:00</td>
            <td>
                <input type="button" class="btn btn-primary" value="更新" th:onclick="'getOneCity(' + ${city.id} + ')'">
            </td>
        </tr>
        </tbody>
    </table>
</div>
<script th:inline="javascript">
    function getOneCity(id) {
        this.window.location.href = "/getOneCity?id=" + id;
    }
</script>
</body>
</html>